<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@page isELIgnored="false" %>


<!-- 购物车首页显示详情 -->
<div class="offcanvas-minicart_wrapper" id="miniCart">
    <div class="offcanvas-body">
        <div class="minicart-content">
            <div class="minicart-heading">
                <h4 class="mb-0">购物车</h4>
                <a class="button-close">
                    <i class="pe-7s-close" data-tippy="关闭" data-tippy-inertia="true"></i>
                </a>
            </div>
            <c:choose>
                <c:when test="${order.itemMap != null}">
                    <ul class="minicart-list">
                        <!-- 购物车商品 -->
                        <c:forEach items="${order.itemMap}" var="item">
                            <li class="minicart-product">

                                <a class="product-item_remove" href="javascript:" onclick="deletes(${item.key});">
                                    <i class="pe-7s-close" data-tippy="删除"></i>
                                </a>
                                <!-- 商品图片 -->
                                <a href="/bookmall/detail/${item.value.book.id}" class="product-item_img" target="_blank">
                                    <img class="img-full" src="${item.value.book.cover}"
                                         alt="${item.value.book.name}" />
                                </a>
                                <div class="product-item_content">
                                    <!-- 商品名称 -->
                                    <a class="product-item_title" href="/bookmall/detail/${item.value.book.id}" target="_blank">
                                            ${item.value.book.name}
                                    </a>
                                    <!-- 数量 x 价格 -->
                                    <span class="product-item_quantity">${item.value.amount} x ¥${item.value.price}</span>
                                </div>
                            </li>
                        </c:forEach>
                    </ul>
                    <div class="minicart-item_total">
                        <span>共计</span>
                        <span class="ammount">¥${order.total}</span>
                    </div>
                    <div class="group-btn_wrap d-grid gap-2">
                        <a href="/bookmall/cart" class="btn btn-dark" id="cartDetail">查看购物车详情</a>
                        <a href="/bookmall/order/submit" class="btn btn-dark">结算</a>
                    </div>
                </c:when>

                <c:otherwise>
                    <div align="center">
                        <span class="title">还是空的，去挑选喜欢的商品吧~</span>
                        <br />
                        <a class="btn sm-size btn-pronia-primary" href="/bookmall/types/all/1">去看看</a>
                    </div>
                </c:otherwise>
            </c:choose>
        </div>
    </div>
</div>

<div class="global-overlay"></div>
